package com.mew.game.core.common.utils;

import com.mew.game.core.common.vo.StrategyGameVO;

import java.util.ArrayList;
import java.util.List;

/***
 * 拉霸工具类
 * @author Administrator
 */
public class GameUtil extends com.mew.common.util.GameUtil {

    /**
     * 构建一个测试用 StrategyGameVO
     * @return
     */
    public static StrategyGameVO buildTestStrategyGameVO(){
        WinFree winFree=new WinFree();
        winFree.setFrees(0);
        winFree.setFreeCount(0);
        winFree.setFreeNumber(0);
        winFree.setFreeType(0);
        winFree.setFreeRate(1);
        winFree.setBounsNumber(0);
        winFree.setBounsType(0);
        winFree.setBounsRate(0);
        winFree.setBounsChange(0);
        winFree.setBet(1000L);
        StrategyGameVO gameVO=new StrategyGameVO();
        gameVO.setRollerId(1);
        gameVO.setInBetNumber(1000L);
        gameVO.setWinFree(winFree);
        return gameVO;
    }

    /**
     * 获取周围图标
     * @param row  行
     * @param col 列
     * @param index 坐标
     * @return 周围图标
     */
    public static List<Integer> getSurroundIcon(int row,int col,int index){
        ArrayList<Integer> indexList=new ArrayList<>();
        //算八个位置的坐标
        if(index/col>0){
            indexList.add(index-col);
            if(index%col>0){
                indexList.add(index-col+1);
            }
            if(index%col<col-1){
                indexList.add(index-col-1);
            }
        }
        if(index/col<row-1){
            indexList.add(index+col);
            if(index%col>0){
                indexList.add(index+col-1);
            }
            if(index%col<6){
                indexList.add(index+col+1);
            }
        }
        if(index%col>0){
            indexList.add(index-1);
        }
        if(index%col<col-1){
            indexList.add(index+1);
        }
        return indexList;
    }
}
